home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / qlib205.zip / QLIB.ZIP / TEST / WIN95.C < prev   
C/C++ Source or Header  |  1997-03-15  |  2KB  |  67 lines

  1. //Windoze 95 title/close tests.
  2.  
  3. #include <qlib.h>
  4. #include <stdio.h>
  5. #include <conio.h>
  6. #include <ctype.h>
  7. #include <process.h>
  8.  
  9.   byte get_title[80];
  10.   byte get_vmtitle[80];
  11.   byte new_title[]="Win95 Test Program";
  12.   byte new_vmtitle[]="Q LIB";
  13.   byte wc=0,t,c;
  14.  
  15. void quit(void) {
  16.   win95_vmtitle_set(get_vmtitle);  //restore VM title (you should do this!)
  17.   printf("\nWin95 VMtitle restored\n");
  18.     //if you do not restore the VM title then the app the lauched this prg
  19.     // will have it's VM title changed forever unless it changes it back.
  20.     // A good example of this is if you run Win95.EXE from a DOS BOX and
  21.     // if the VM is changed and not restore then the DOS BOX will have the
  22.     // new name, even if the DOS BOX is closed and reopened!
  23.   exit(0);
  24. }
  25.  
  26. void main(void) {
  27.   
  28.   if (win95_close_enable()==ERROR) {
  29.     printf("Win95 Close Notification not available\n");
  30.   } else wc=1;
  31.  
  32.   if (win95_title_get(get_title,80)==ERROR)
  33.     printf("Win95 Get Program Title failed\n");
  34.   else
  35.     printf("Old Program Name:%s\n",get_title);
  36.   if (win95_title_set(new_title)==ERROR)
  37.     printf("Win95 Set Program Title failed\n");
  38.   else
  39.     printf("New Program Name:%s\n",new_title);
  40.  
  41.   if (win95_vmtitle_get(get_vmtitle,80)==ERROR)
  42.     printf("Win95 Get VM Title failed\n");
  43.   else
  44.     printf("Old VM Name:%s\n",get_vmtitle);
  45.   if (win95_vmtitle_set(new_vmtitle)==ERROR)
  46.     printf("Win95 Set VM Title failed\n");
  47.   else
  48.     printf("New VM Name:%s\n",new_vmtitle);
  49.  
  50.   printf("Press 'q' to quit...\n");
  51.   while (1){
  52.     if (toupper(getche())=='Q') quit();
  53.     if (wc) {
  54.       t=win95_close_query();
  55.       if (t==WIN95_CLOSE_NOACK) win95_close_ack();
  56.       if (t==WIN95_CLOSE_ACK) {
  57.         printf("\nProgram Exit Requested!\n Press 'q' to quit or 'c' to cancel...\n");
  58.         while (1) {
  59.           c=toupper(getch());
  60.           if (c=='C') { win95_close_cancel(); break;}
  61.           if (c=='Q') quit();
  62.         }
  63.       }
  64.     }
  65.   }
  66. }
  67.